<style tyle="text/css">
    .modal-lg {
        width: 70%;
    }
</style>
<div class="modal-header">
    <h4 class="modal-title">
        分销商授权
    </h4>
</div>
<div class="modal-body">
    
    <!-- <h5 class="modal-title"> -->
            <form name="form" class="form-horizontal ng-pristine ng-valid-required">
                    <div class="form-group">
                        <label class="col-lg-3 control-label">产品名称:</label>
                        <label class="col-lg-4" style=" padding-top: 7px;">
                                {{office.name}} 
                        </label>
                        
                    </div>
                    <div class="form-group">
                            <label class="col-lg-3 control-label">价格:</label>
                            <label class="col-lg-4" style=" padding-top: 3px;">
                                    供货价格：<strong style="color:red;font-size: 18px;">{{office.cost_price}}</strong>元 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;指导价格：<strong style="font-size: 18px;">{{office.guide_price}}</strong>元
                            </label>
                        </div>
                </form>
                
                <!-- ：{{office.name}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;供货价格：{{office.cost_price}}元 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;指导价格：{{office.guide_price}}元 -->
    <!-- </h5> -->
    <!-- <strong style="font-size: 16px" ;>添加分销商授权</strong> -->
        <!-- <hr style="margin-top: 0px; margin-bottom: 15px;"> -->
<br>
<h4 >添加分销商授权</h4>
    <!-- <strong style="font-size: 16px" ;>添加分销商授权</strong> -->
    <hr style="margin-top: 0px; margin-bottom: 15px;">
    <form name="form" class="form-horizontal ng-pristine ng-valid-required">
        <div class="form-group">
            <label class="col-lg-2 control-label">选择分销商:</label>
            <div class="col-lg-4">
                <ui-select ng-model="search.office" theme="bootstrap">
                    <ui-select-match placeholder="选择机构...">{{$select.selected.name}} ( {{$select.selected.code}} )</ui-select-match>
                    <ui-select-choices repeat="office in office_list | filter: {'name': $select.search}">
                        <span>{{office.name}} ( {{office.code}} )</span>
                    </ui-select-choices>
                </ui-select>
            </div>
            <div class="col-lg-5">
                <div class="pull-left" style="margin-top: 7px;">
                    供货价&nbsp;&nbsp;+&nbsp;&nbsp;
                </div>
                <div class="pull-left" style="width: 170px;">
                    <input type="number" class="form-control" ng-model="floating_price" ng-disabled="true">
                </div>
                <div class="pull-left" style="margin-top: 7px;">
                    &nbsp;&nbsp;元
                </div>
                <button class="pull-right btn btn-success" type="button" ng-click="add()">添加</button>
            </div>
            <!-- <label class="col-lg-1">
               
            </label> -->
        </div>
    </form>

    <h4 >已授权分销商</h4>
    <hr style="margin-top: 0px; margin-bottom: 15px;">
    <div class="panel panel-default" ng-if="company_list.length > 0">
        <table class="table table-striped table-bordered table-condensed tree_table">
            <thead>
                <tr>
                    <!-- <th class="col-md-1 text-center">产品名称</th> -->
                    <th class="text-center">分销商名称(编号)</th>
                    <!-- <th class="col-md-1 text-center">机构编号</th> -->
                    <th class="text-center" style="width: 390px;">结算价格(元)</th>
                    <th style="width: 8%">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="info in company_list">
                    <!-- <td class="text-center">{{office.name}}</td> -->
                    <td>{{info.target_company_name}}（{{info.downstream_company_code}}）</td>
                    <!-- <td class="text-center">{{info.downstream_company_code}}</td> -->
                    <td class="text-center">
                        <div class="input-group">
                            <!-- <span class="input-group-addon"> -->
                            <div class="pull-left" style="margin-top: 2px;">
                                供货价&nbsp;&nbsp;+&nbsp;&nbsp;
                            </div>
                            <div class="pull-left" style="width: 140px;">
                                <input type="number" ng-disabled="true" class="form-control" style="height: 25px;" min="0" ng-model="info.floating_price" ng-change="change($index)">
                            </div>
                            <div class="pull-left" style="margin-top: 2px;">
                                元&nbsp;&nbsp;=&nbsp;&nbsp;{{(info.floating_price + office.cost_price).toFixed(2)}}元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </div>
                            <div class="pull-left">
                                <button ng-show="info.is_edit" class="btn btn-xs btn-success" ng-click="save(info, $index)">
                                    保存
                                </button>
                            </div>
                            <!-- </span> -->
                            <!-- <span class="input-group-addon"> -->
                            <!-- </span> -->
                        </div>
                    </td>
                    <td class="text-center">
                        <button class="btn btn-xs" ng-click="remove(info.downstream_company_code)">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>


</div>
<div class="modal-footer">
    <button class="btn btn-danger" type="button" ng-click="ok()">关闭</button>
    <!-- <button class="btn btn-danger" type="button" ng-click="cancel()">取消</button> -->
</div>